GBML manual / Effects

shroud_cutout

Makes this instance a light source: it cuts a hole `radius` pixels across in the current room’s shroud, wherever it stands, optionally flickering rather than holding steady.

Works differently on Game Boy - The Game Boy makes a dark room darker and keeps the sprites near a light in their own shades; it cannot light the picture, which has one set of shades. Up to 4 lights.

Works differently on Game Boy Color - The Game Boy Color darkens a dark room and lights the 8 by 8 pixel squares whose middle is inside the light. Up to 4 lights, no flicker, a picture of 3 palettes at most and 4 sprite palettes at most.

Works differently on Sega Genesis - The Sega Genesis has one dark level: half as bright as the picture. Every darkness number above 0 shows that same dark (a room set to 72 is no darker than one set to 50), and 0 is no dark at all. A light made from code (shroud_cutout, shroud_cutout_sprite, shroud_cutout_sprite_angle) cuts its hole in that dark. The hole is a picture made ahead of time from the circle or from the sprite the call names, so the sprite's name must be written in the call (not chosen while the game plays), a size or a direction the code works out while the game plays is shown as the nearest one made (six sizes from half to double, sixteen directions), and a size or direction written as a number is exact. Each picture takes cartridge space and some of the picture chip's sprites (the build says how many and refuses a set of lights the chip cannot hold). An object stands in the light as a whole while its middle is in the light, and a light near the edge of the screen is whole or gone.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

shroud_cutout(radius, flicker)

Arguments

NameType
radiusreal
flickerbool

Returns

Nothing.

Description

Makes this instance a light source. It cuts a hole radius pixels across in the room's shroud, wherever it happens to be standing - flicker decides whether that hole wavers like a flame or holds perfectly steady like a lamp.

The hole follows the instance on its own, every frame, so a light carried by something that moves needs no further code. See Particles and lighting for how the shroud itself works.

A light only shows where there is dark

Whether a room is dark at all is the room's own setting, not the light's. A light attached in a bright room is simply inert: no shroud to cut, nothing drawn, nothing wasted, and not a mistake. That independence is what lets the same torch object be pure decoration in a daylit room and a real light source in a cellar, with no second version of it and no check inside it.

Calling it again replaces this instance's light rather than adding a second one, and shroud_cutout(0, false) turns it back off - there is no separate detach.

Example

shroud_cutout(27, true);

A torch: a pool of light about 54 pixels across, flickering. Put it in Create and nothing else is needed - the light is attached for the life of the instance, and moves with it.

A real capture - a soft pool of light cut into this shrouded room's own darkness, centered on the instanceA real capture - a soft pool of light cut into this shrouded room's own darkness, centered on the instance
A real capture - a soft pool of light cut into this shrouded room's own darkness, centered on the instance

On the GBA

A light only shows where there is a shroud to cut: in a room that is not marked shrouded it is inert, costs nothing and is not an error - the same independence that lets a torch be decorative in a bright room and a real light in a dark one. The hole follows the instance every frame, so a light on a moving instance needs no per-frame call. Calling it again replaces this instance’s own light rather than adding a second one, and `shroud_cutout(0, false)` turns it back off - there is no separate detach.

See also: Particles and lightingRoom lightingeffect_burst